// es6 垫片，要兼容 IE
require('es6-shim')
var pinyin = require("chinese-to-pinyin");
require("./path"); // 异步组件

import Vue from 'vue'
import vuex from 'vuex'
import App from './App'
import router from './router'
import store from './store/index.js';
import Global from './tools/global';
import axios from './tools/axios'
import login from './tools/checkAuth'
import ElementUI from 'element-ui'
import common from './tools/common'
import uploader from 'vue-simple-uploader'
import VCharts from 'v-charts'
import JsonExcel from 'vue-json-excel'
import vueXlsxTable from 'vue-xlsx-table'
import videojs from 'video.js'
import 'video.js/dist/video-js.css'
import './assets/video.css'
import SWF_PATH from 'videojs-swf/dist/video-js.swf';
import 'babel-polyfill'
import 'element-ui/lib/theme-chalk/index.css';
import '../static/css/index.css'

// import Tree from './components/public/tree'
// Vue.component('zh-tree', Tree)

//webrtc
import "./player/srsRtc.js";
import "./player/DPlayer.min.js";

import ImageViewer from "./components/public/image-viewer.vue";
Vue.component('ImageViewer', ImageViewer)

Vue.use(VCharts)
Vue.use(uploader)
Vue.use(vueXlsxTable, {
  rABS: false
})
Vue.use(ElementUI, { //全局配置对象 size 改变组件的默认尺寸
  size: 'small',
})

Vue.config.productionTip = false
Vue.component('downloadExcel', JsonExcel)
// videojs.options.flash.swf = SWF_PATH;

Vue.prototype.$videojs = videojs
Vue.prototype.$ajax = axios
Vue.prototype.$g = Global; // 全局变量
Vue.prototype.$pinyin = pinyin;
Vue.prototype.BASE_URL = sessionStorage.getItem('host_addr');
Vue.prototype.BASE_token = sessionStorage.getItem('token');

import { message } from './tools/resetMessage';
Vue.prototype.$message = message;


//重写调试, 避免生产环境发生意外
if (process.env.NODE_ENV == 'production') {
  console.log = () => { }
  window.alert = () => { }
}


new Vue({
  el: '#app',
  router,
  store,
  components: {
    App
  },
  template: '<App/>'
})

window.$global = new Vue //子组件调用父组件全局变量
